Skip to content

Exposes target_system on connect(). Exposes MAVConnection. - #448

Merged
tcr3dr merged 2 commits into
masterfrom
tcr-targets
Nov 17, 2015
Merged

tcr3dr merged 2 commits into
masterfrom
tcr-targets

Conversation

@tcr3dr

@tcr3dr tcr3dr commented Nov 11, 2015

Copy link
Copy Markdown
Contributor

See #400.

connect('tcp:...:...', target_system=0, target_component=100)

@hamishwillee

Copy link
Copy Markdown
Contributor

@tcr3dr Can you confirm that parameters are the system/component ID that we are connecting to, and that the plan is to use these when sending messages as in #400 rather than whatever value the user puts in:

 msg = vehicle.message_factory.mount_control_encode(
        0, 0,  # target system, target component

Is that correct? Are the 0 values above just ignored?

My feeling is that this isn't quite right.

I think if you have a function like the above which you are explicitly calling it should obey the system/target you enter. If we use the function internally in an exposed API (e.g. goto) then we would pass in our target_system value because this is the target that the vehicle represents.

Things are different for target_component because a vehicle represents a particular system, not a particular system and component. Do we really want to switch vehicle to talk to a camera mount (say)? I suspect that we will need to use broadcast ID to talk to components and hope that the message gets forwarded appropriately. When sending messages "manually" as above, I would assume the coder would think about which component ID they want to direct it to, and we shouldn't override that (just advise use of the broadcast id)

Last of all, we also want DroneKit to be able to change its own system_id so that it is possible for multiple dronekit systems to co-exist and communicate with each other. I am not sure if DK also needs to be able to set its own component ID, but let's pretend a use case exists ....

Hope some of that makes sense. As I said, I may have got this completely wrong.

@tcr3dr

tcr3dr commented Nov 12, 2015

Copy link
Copy Markdown
Contributor Author

@hamishwillee,

This PR now only allows the specification of the target_system ID. This is all that gets overwritten in MAVLink commands sent using the vehicle object.

If you deliver messages directly to the vehicle send_mavlink command, the target_system still gets overwritten. I'm unsure what to do here; I feel like we should expect the target_system to be fixed to that of the vehicle it's being called on. If we want to communicate with other target_systems, it should be done through (perhaps) another interface?

We should support the changing of our own system's system_id, but I am not sure how that logic works yet, and seems like it can be an enhancement.

@hamishwillee

Copy link
Copy Markdown
Contributor

@tcr3dr Isn't the target_system id the ID of the system you want to talk to? In that case, wouldn't you be better off querying that from the vehicle you've connected to rather than trying to set it in connect?. I presume this is what we do now but maybe we just always broadcast.

Once we have the value, however we get it, then yes, we should use it for our internal message sending since vehicle represents a specific vehicle.

My (possibly idiotic) take on communicating with other systems is that if you want to do this you should create a separate vehicle object and handle any inter-vehicle communication in your script. The implication of this is

  • Yes, the target_system_id should be used for all communication from this vehicle object (overwriting whatever might be set in send_mavlink.
  • IMO if we aren't allowing people to set this parameter in send_mavlink, we should probably remove it from the public API (and if we call the same API internally, we'll need both an internal and external message sending API)

Yes, changing our own system_id is an enhancement. I don't think this is complicated - and in most cases it is something you wouldn't need to do. I'll leave you to create a separate issue because I'm a little lazy!

@tcr3dr tcr3dr changed the title Exposes target_system and target_component on connect(). Exposes target_system on connect(). Exposes MAVConnection. Nov 17, 2015
tcr3dr added a commit that referenced this pull request Nov 17, 2015
Exposes target_system on connect(). Exposes MAVConnection.
@tcr3dr
tcr3dr merged commit 0f14b49 into master Nov 17, 2015
@hamishwillee

Copy link
Copy Markdown
Contributor

@tcr3dr

I still think it doesn't make much sense to allow people to specify the target_system - this should be obtained from the connected vehicle.

That said, can you confirm that target_system parameter is only thing requiring docs from this?

@tcr3dr

tcr3dr commented Nov 17, 2015

Copy link
Copy Markdown
Contributor Author

@hamishwillee See #458. It makes sense in that we actually have a manual override in the Solo code—also this is the first step to implementing it as an automatic process.

target_system is the only thing requiring docs. I may or may not be exposing MAVConnection but it probably involves another PR and me writing up some examples about that. For now, ignore.

@hamishwillee

Copy link
Copy Markdown
Contributor

@tcr3dr Does this also set the target_system used when you set a Command (in a waypoint)?

@tcr3dr
tcr3dr deleted the tcr-targets branch November 18, 2015 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants